<?php
$danhmuc=$_REQUEST['parent'];
echo $danhmuc."<br/>";;

$tu=$_REQUEST['tu'];
echo $tu."<br/>";

$den=$_REQUEST['den'];
echo $den."<br/>";

$sql1="select id from tbl_product_category where parent='$danhmuc'";
$query1 = mysql_query($sql1);
	if(mysql_num_rows($query1)==0)
	{
		$sql="select * from tbl_product where parent='$danhmuc'";
		$query = mysql_query($sql,$conn);
			if(mysql_num_rows($query)==0)
			{	
				echo "khong1";
			}
			else
			{
				while($row=mysql_fetch_assoc($query))
				{
					echo $row['name'];
				}
			}

	}
	else
	{
		while($row1=mysql_fetch_assoc($query1))
		{
			$danhmuc=$row1['id'];
			$sql="select * from tbl_product where parent='$danhmuc'";
			$query = mysql_query($sql,$conn);
			if(mysql_num_rows($query)==0)
			{	
				echo "khong2";
				break;
			}
			else
			{
				while($row=mysql_fetch_assoc($query))
				{
					echo $row['name']."<br/>";
				}
			}
		}
	}



?>

